package com.qzw.demo.service.entity;

import com.qzw.common.service.BaseEntity;
import com.qzw.common.util.GeneratorNote;
import lombok.Data;
import org.hibernate.annotations.ColumnDefault;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.OneToMany;
import javax.persistence.Version;
import java.math.BigDecimal;
import java.util.Set;

/**
 * @author: 屈子威
 * @create: 2020-07-14
 * @description: 商品实体类
 **/
@Entity
@DynamicInsert
@DynamicUpdate
@Data
public class DmShop extends BaseEntity<Integer> {

    @GeneratorNote("商品名称")
    private String name;

    @GeneratorNote("商品数量")
    private BigDecimal quantity;

    @GeneratorNote("商品价格")
    @ColumnDefault("0")
    private BigDecimal amount;

    @Version
    private Long version;

    @OneToMany(fetch = FetchType.LAZY)
    private Set<DmOrder> dmOrders;
}
